<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Hard
  </div>
  <div>
   <h1 class="question_title">
    126. Word Ladder II
   </h1>
   <p>
    Given two words (
    <em>
     beginWord
    </em>
    and
    <em>
     endWord
    </em>
    ), and a dictionary's word list, find all shortest transformation sequence(s) from
    <em>
     beginWord
    </em>
    to
    <em>
     endWord
    </em>
    , such that:
   </p>
   <ol>
    <li>
     Only one letter can be changed at a time
    </li>
    <li>
     Each transformed word must exist in the word list. Note that
     <em>
      beginWord
     </em>
     is
     <em>
      not
     </em>
     a transformed word.
    </li>
   </ol>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <ul>
    <li>
     Return an empty list if there is no such transformation sequence.
    </li>
    <li>
     All words have the same length.
    </li>
    <li>
     All words contain only lowercase alphabetic characters.
    </li>
    <li>
     You may assume no duplicates in the word list.
    </li>
    <li>
     You may assume
     <em>
      beginWord
     </em>
     and
     <em>
      endWord
     </em>
     are non-empty and are not the same.
    </li>
   </ul>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong>
beginWord = "hit",
endWord = "cog",
wordList = ["hot","dot","dog","lot","log","cog"]

<strong>Output:</strong>
[
  ["hit","hot","dot","dog","cog"],
&nbsp; ["hit","hot","lot","log","cog"]
]
</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong>
beginWord = "hit"
endWord = "cog"
wordList = ["hot","dot","dog","lot","log"]

<strong>Output: </strong>[]

<strong>Explanation:</strong>&nbsp;The endWord "cog" is not in wordList, therefore no possible<strong>&nbsp;</strong>transformation.
</pre>
   <ul>
   </ul>
  </div>
  <div>
   <h1 class="question_title">
    126. 单词接龙 II
   </h1>
   <p>
    给定两个单词（
    <em>
     beginWord
    </em>
    和
    <em>
     endWord
    </em>
    ）和一个字典
    <em>
     wordList
    </em>
    ，找出所有从
    <em>
     beginWord
    </em>
    到
    <em>
     endWord
    </em>
    的最短转换序列。转换需遵循如下规则：
   </p>
   <ol>
    <li>
     每次转换只能改变一个字母。
    </li>
    <li>
     转换过程中的中间单词必须是字典中的单词。
    </li>
   </ol>
   <p>
    <strong>
     说明:
    </strong>
   </p>
   <ul>
    <li>
     如果不存在这样的转换序列，返回一个空列表。
    </li>
    <li>
     所有单词具有相同的长度。
    </li>
    <li>
     所有单词只由小写字母组成。
    </li>
    <li>
     字典中不存在重复的单词。
    </li>
    <li>
     你可以假设
     <em>
      beginWord
     </em>
     和
     <em>
      endWord
     </em>
     是非空的，且二者不相同。
    </li>
   </ul>
   <p>
    <strong>
     示例 1:
    </strong>
   </p>
   <pre><strong>输入:</strong>
beginWord = "hit",
endWord = "cog",
wordList = ["hot","dot","dog","lot","log","cog"]

<strong>输出:</strong>
[
  ["hit","hot","dot","dog","cog"],
&nbsp; ["hit","hot","lot","log","cog"]
]
</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre><strong>输入:</strong>
beginWord = "hit"
endWord = "cog"
wordList = ["hot","dot","dog","lot","log"]

<strong>输出: </strong>[]

<strong>解释:</strong>&nbsp;<em>endWord</em> "cog" 不在字典中，所以不存在符合要求的转换序列。</pre>
  </div>
 </body>
</html>